<%@page contentType="text/html;charset=UTF-8"%> 
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles" %>


<style>
<!--
	.selected {
    background-color: #f5f5f5;
}
-->
</style>
<script type="text/javascript">
$(document).ready(function(){
	$("#table #rows").click(function(){
		   $(this).addClass('selected').siblings().removeClass('selected');    
		   var idphancong = $(this).find('td:eq(0)').html();
		  $('#btnXacNhan').attr('href', 'xacnhanhoantat/'+idphancong);
		  })
});	
</script>

<!-- MODAL XAC NHAN HOAN TAT -->
<div class="modal fade" id="xacnhan" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Xác nhận hoàn tất</h4>
</div>
<div class="modal-body">
	<p style="color: red;">Bạn có chắc muốn xác nhận không !!!</p>
</div><!-- END modal-body -->
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Hủy</button>
    <a class="btn btn-primary" id="btnXacNhan" >Xác nhận</a>
</div>
</div><!-- END modal-content -->
</div><!-- END modal-dialog modal-lg -->
</div><!-- END modal fade bs-example-modal-lg -->
<!-- END MODAL XAC NHAN HOAN TAT-->
<div class="modal fade" id="xacnhan" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Xác nhận hoàn tất</h4>
</div>
<div class="modal-body">
	<p style="color: red;">Bạn có chắc muốn xác nhận không !!!</p>
</div><!-- END modal-body -->
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Hủy</button>
    <a class="btn btn-primary" id="btnXacNhan" >Xác nhận</a>
</div>
</div><!-- END modal-content -->
</div><!-- END modal-dialog modal-lg -->
</div><!-- END modal fade bs-example-modal-lg -->
<!-- END MODAL XAC NHAN HOAN TAT-->
<c:if test="${!empty PhancongcongvandenGiangvien}">
<c:if test="${!empty PhancongcongvandenBomon}">
	<table class="table table-hover" id="table">
		<tr>
			<th width="80">Mã Công Văn</th>
			<th width="120">Phân công đến</th>
			<th width="80">Ngày phân công</th>
			<th width="120">Hạn chót</th>
			<th width="120">Người phân công</th>
			<th width="120">Xác nhận BCN</th>
			<th width="120">Xác nhận hoàn tất</th>
			<th width="120">Xác nhận</th>
			<th width="120">Xem chi tiết</th>
		</tr>
		<c:forEach items="${PhancongcongvandenGiangvien}" var="pcGV">	
			<c:if test="${pcGV.giangvien.canbo.idCanBo == idcanbo}">	
				<tr id="rows">
					<td>${pcGV.phancongcongvanden.congvanden.idCongVanDen}</td>
					<td>${pcGV.giangvien.canbo.tenCanBo}</td>
					<td>${pcGV.phancongcongvanden.ngayPhanCong}</td>
					<td>${pcGV.phancongcongvanden.hanCuoi}</td>
					<td>${pcGV.phancongcongvanden.nguoiPhanCong}</td>
					<c:choose>
						<c:when test="${pcGV.phancongcongvanden.xacNhanBcn == 1}">
							<td><input type="checkbox" id="xacnhan_true" checked/></td>
						</c:when>
						<c:otherwise>
							<td><input type="checkbox" id="xacnhan_tb" /></td>
						</c:otherwise>
					</c:choose>
					<c:choose>
						<c:when test="${pcGV.phancongcongvanden.xacNhanHoanTat == 1}">
							<td><input type="checkbox" id="xacnhan_true" checked/></td>
							<td><a class="btn btn-primary" href="<c:url value='/boxacnhanbomon/${pcGV.idPhanCong}' />">Bỏ</a></td>
						</c:when>
						<c:otherwise>
							<td><input type="checkbox" id="xacnhan_tb" /></td>
							<td><a class="btn btn-primary" href="<c:url value='/xacnhanhoantatbomon/${pcGV.idPhanCong}' />">Xác nhận</a></td>
						</c:otherwise>
					</c:choose>
									<td><a class="btn btn-primary" href="<c:url value='/chitietcongvandenbomon/${pcGV.phancongcongvanden.congvanden.idCongVanDen}' />">Chi tiết</a></td>
				</tr>
				</c:if>
		</c:forEach>
				<c:forEach items="${PhancongcongvandenBomon}" var="pcBM">
					<c:if test="${pcBM.bomon.idBoMon == idbomon}">		
				<tr id="rows">
					<td>${pcBM.phancongcongvanden.congvanden.idCongVanDen}</td>
					<td>${pcBM.bomon.tenBoMon}</td>
					<td>${pcBM.phancongcongvanden.ngayPhanCong}</td>
					<td>${pcBM.phancongcongvanden.hanCuoi}</td>
					<td>${pcBM.phancongcongvanden.nguoiPhanCong}</td>
					<c:choose>
						<c:when test="${pcBM.phancongcongvanden.xacNhanBcn == 1}">
							<td><input type="checkbox" id="xacnhan_true" checked/></td>
						</c:when>
						<c:otherwise>
							<td><input type="checkbox" id="xacnhan_tb" /></td>
						</c:otherwise>
					</c:choose>
					<c:choose>
						<c:when test="${pcBM.phancongcongvanden.xacNhanHoanTat == 1}">
							<td><input type="checkbox" id="xacnhan_true" checked/></td>
							<td><a class="btn btn-primary" href="<c:url value='/boxacnhanbomon/${pcBM.idPhanCong}' />">Bỏ</a></td>
						</c:when>
						<c:otherwise>
							<td><input type="checkbox" id="xacnhan_tb" /></td>
							<td><a class="btn btn-primary" href="<c:url value='/xacnhanhoantatbomon/${pcBM.idPhanCong}' />">Xác nhận</a></td>
						</c:otherwise>
					</c:choose>
				<td><a class="btn btn-primary" href="<c:url value='/chitietcongvandenbomon/${pcBM.phancongcongvanden.congvanden.idCongVanDen}' />">Chi tiết</a></td>
				</tr>
				</c:if>
		</c:forEach>
				
	</table>
	</c:if>
</c:if>

